local scene = gamestate.new()

local x = 100
local y = 200
local w = 400
local h = 30
local off = 20

function scene:enter(from,data)
	local sw,sh = love.graphics.getDimensions()
	x = sw*GlobalScale/2 - w/2
	self.ui = {}
	for id,score in pairs(data) do
		print(id,score)
		table.insert(self.ui,{text = id .. "-".. score})
	end
end

function scene:update(dt)
	love.graphics.setFont(texture.font)
	suit.Label("游戏结束",x,y-100,w,h)
	local offy = 0
	for i = 1,#self.ui do
	    local b = self.ui[i]
	    local r = suit.Button(b.text,b,x,y+offy,w,h)
	    if r.entered then
	        sound:play("hover")
	    end
		offy = offy + (h + off)
	end
end

function scene:draw()
	suit.draw()
end

function scene:keypressed(k)
	if k == "escape" then
		gamestate.switch(gameState.title)
	end
end

return scene